// 方法-继承-示例
package main

import "fmt"

type Human struct {
	name  string
	age   int
	phone string
}

type Student struct {
	Human // 匿名字段
	school string
}

type Employee struct {
	Human // 匿名字段
	company string
}

func (h *Human) SayHi() {
	fmt.Printf("Hi, I am %s you can call me on %s\n", h.name, h.phone)
}

func main() {
	mark := Student{Human{"Mark", 25, "13512345678"}, "MIT"}
	sam := Employee{Human{"Sam", 45, "13512345679"}, "Golang Inc"}

	mark.SayHi()
	sam.SayHi()
}